Tabbar 导航

"tabBar": {
"color": "#74777e",
"selectedColor": "#2cc17B",
"borderStyle": "white",
"backgroundColor": "#fff",
"list": [
{
"pagePath": "pages/index/index",
"iconPath": "images/tab_index.png",
"selectedIconPath": "images/tab_index_s.png",
"text": "主页"
},
{
"pagePath": "pages/anli/anli",
"iconPath": "images/eff.png",
"selectedIconPath": "images/eff_select.png",
"text": "效果图"
},
{
"pagePath": "pages/work/work",
"iconPath": "images/tab_shi_n.png",
"selectedIconPath": "images/tab_shi_p.png",
"text": "施工图"
}
]
}

picker

<picker value ="{{index}}" range="{{worklist}}" range-key="label"
bindchange="bindPickerChange">
<view class="picker">
{{worklist[index].label}}
</view>
</picker>
bindPickerChange:function(e){
const val = e.detail.value;
console.log( e.detail.value)
}

下拉刷新

<view class="container">
<scroll-view scroll-top="{{scrollTop}}" scroll-y="true" style="height:{{scrollHeight}}px;"
class="list" bindscrolltolower="bindDownLoad" bindscroll="scroll" bindscrolltoupper="refresh">
<view class="item" wx:for="{{list}}">
<image class="img" src="{{item.pic_url}}"></image>
<view class="text">
<text class="title">{{item.name}}</text>
<text class="description">{{item.short_description}}</text>
</view>
</view>
</scroll-view>
<view class="body-view">
<loading hidden="{{hidden}}" bindchange="loadingChange">
加载中...
</loading>
</view></view>

跳转导航

handSelect:function(e){
var id = e.currentTarget.dataset.id;
//跳转
wx.navigateTo({
url: '../master/master?id='+id
})
}
//要用相对路径的,pages在app.json需要定义

城市选择

// 使用region 模式可以用于选择省份城市
<view class="section">
<view class="section__title">省市区选择器</view>
<picker mode="region" bindchange="bindRegionChange" value="{{region}}" custom-item="{{customItem}}">
<view class="picker">
当前选择:{{region[0]}},{{region[1]}},{{region[2]}}
</view>
</picker>
</view>
</view>
bindRegionChange: function (e) {
console.log('picker发送选择改变,携带值为', e.detail.value)
this.setData({
region: e.detail.value
})
}